'''
Created on 11 Nov 2010

@author: Rasherz
'''
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from littlecrawler.items import LittlecrawlerItem


class LittleSpider(BaseSpider):
    name = "littlewoods.com"
    allowed_domains = ["littlewoods.com"]
    start_urls = [
        "http://www.littlewoods.com/adidas-originals-originals-winter-jacket/803588728.prd",
    ]

    def parse(self, response):
        hxs = HtmlXPathSelector(response)
         
        site = hxs
        
        #uniString = unicode(myString, "UTF-8")
        item = LittlecrawlerItem()
        item['title'] = site.select('//div[@id="productHeader"]/h1/text()').extract()
        item['image'] = site.select('//p[@id="productMainImage"]/@rel').extract()
        item['desc'] = site.select('//div[@id="productDesc"]/text()').extract()
        
        return item